<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>OS Tick API</title>
<title>CMSIS-RTOS2: OS Tick API</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="cmsis.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<script type="text/javascript" src="printComponentTabs.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 46px;">
  <td id="projectlogo"><img alt="Logo" src="CMSIS_Logo_Final.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">CMSIS-RTOS2
   &#160;<span id="projectnumber">Version 2.1.3</span>
   </div>
   <div id="projectbrief">Real-Time Operating System: API and RTX Reference Implementation</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<div id="CMSISnav" class="tabs1">
    <ul class="tablist">
      <script type="text/javascript">
		<!--
		writeComponentTabs.call(this);
		//-->
      </script>
	  </ul>
</div>
<!-- Generated by Doxygen 1.8.6 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Usage&#160;and&#160;Description</span></a></li>
      <li><a href="modules.html"><span>Reference</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('group__CMSIS__RTOS__TickAPI.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Macros</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Groups</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark">&#160;</span>Pages</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">OS Tick API</div>  </div>
</div><!--header-->
<div class="contents">

<p>System tick timer interface for periodic RTOS Kernel Ticks defined in <b>os_tick.h</b>  
<a href="#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga5eeffb4d9dc6c6802fee8898096d9a59"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__CMSIS__RTOS__TickAPI.html#ga5eeffb4d9dc6c6802fee8898096d9a59">OS_Tick_Setup</a> (uint32_t freq, <a class="el" href="os__tick_8h.html#afbfa2180a9b6208f34891d539e9e2d52">IRQHandler_t</a> handler)</td></tr>
<tr class="memdesc:ga5eeffb4d9dc6c6802fee8898096d9a59"><td class="mdescLeft">&#160;</td><td class="mdescRight">Setup OS Tick timer to generate periodic RTOS Kernel Ticks.  <a href="#ga5eeffb4d9dc6c6802fee8898096d9a59">More...</a><br/></td></tr>
<tr class="separator:ga5eeffb4d9dc6c6802fee8898096d9a59"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga3e47971bf3a02599d9ecb32208adafec"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__CMSIS__RTOS__TickAPI.html#ga3e47971bf3a02599d9ecb32208adafec">OS_Tick_Enable</a> (void)</td></tr>
<tr class="memdesc:ga3e47971bf3a02599d9ecb32208adafec"><td class="mdescLeft">&#160;</td><td class="mdescRight">Enable OS Tick timer interrupt.  <a href="#ga3e47971bf3a02599d9ecb32208adafec">More...</a><br/></td></tr>
<tr class="separator:ga3e47971bf3a02599d9ecb32208adafec"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga5e325c304fef5003b1dc31906f6a3056"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__CMSIS__RTOS__TickAPI.html#ga5e325c304fef5003b1dc31906f6a3056">OS_Tick_Disable</a> (void)</td></tr>
<tr class="memdesc:ga5e325c304fef5003b1dc31906f6a3056"><td class="mdescLeft">&#160;</td><td class="mdescRight">Disable OS Tick timer interrupt.  <a href="#ga5e325c304fef5003b1dc31906f6a3056">More...</a><br/></td></tr>
<tr class="separator:ga5e325c304fef5003b1dc31906f6a3056"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga57065ec4b281504ad4de13a419870b4f"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__CMSIS__RTOS__TickAPI.html#ga57065ec4b281504ad4de13a419870b4f">OS_Tick_AcknowledgeIRQ</a> (void)</td></tr>
<tr class="memdesc:ga57065ec4b281504ad4de13a419870b4f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Acknowledge execution of OS Tick timer interrupt.  <a href="#ga57065ec4b281504ad4de13a419870b4f">More...</a><br/></td></tr>
<tr class="separator:ga57065ec4b281504ad4de13a419870b4f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaa8b4eca23e3ffe2df403291958cdc905"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__CMSIS__RTOS__TickAPI.html#gaa8b4eca23e3ffe2df403291958cdc905">OS_Tick_GetIRQn</a> (void)</td></tr>
<tr class="memdesc:gaa8b4eca23e3ffe2df403291958cdc905"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get OS Tick timer IRQ number.  <a href="#gaa8b4eca23e3ffe2df403291958cdc905">More...</a><br/></td></tr>
<tr class="separator:gaa8b4eca23e3ffe2df403291958cdc905"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga936217ea28236fb57648973e0d8f627a"><td class="memItemLeft" align="right" valign="top">uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__CMSIS__RTOS__TickAPI.html#ga936217ea28236fb57648973e0d8f627a">OS_Tick_GetClock</a> (void)</td></tr>
<tr class="memdesc:ga936217ea28236fb57648973e0d8f627a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get OS Tick timer clock frequency.  <a href="#ga936217ea28236fb57648973e0d8f627a">More...</a><br/></td></tr>
<tr class="separator:ga936217ea28236fb57648973e0d8f627a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga123151dc19d5a94a68f12cdbf61a9bb5"><td class="memItemLeft" align="right" valign="top">uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__CMSIS__RTOS__TickAPI.html#ga123151dc19d5a94a68f12cdbf61a9bb5">OS_Tick_GetInterval</a> (void)</td></tr>
<tr class="memdesc:ga123151dc19d5a94a68f12cdbf61a9bb5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get OS Tick timer interval reload value.  <a href="#ga123151dc19d5a94a68f12cdbf61a9bb5">More...</a><br/></td></tr>
<tr class="separator:ga123151dc19d5a94a68f12cdbf61a9bb5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaa64a145a554f1e5077848938d7f39c92"><td class="memItemLeft" align="right" valign="top">uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__CMSIS__RTOS__TickAPI.html#gaa64a145a554f1e5077848938d7f39c92">OS_Tick_GetCount</a> (void)</td></tr>
<tr class="memdesc:gaa64a145a554f1e5077848938d7f39c92"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get OS Tick timer counter value.  <a href="#gaa64a145a554f1e5077848938d7f39c92">More...</a><br/></td></tr>
<tr class="separator:gaa64a145a554f1e5077848938d7f39c92"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga1f9a593126b7f0b66fc526c2cebd6192"><td class="memItemLeft" align="right" valign="top">uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__CMSIS__RTOS__TickAPI.html#ga1f9a593126b7f0b66fc526c2cebd6192">OS_Tick_GetOverflow</a> (void)</td></tr>
<tr class="memdesc:ga1f9a593126b7f0b66fc526c2cebd6192"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get OS Tick timer overflow status.  <a href="#ga1f9a593126b7f0b66fc526c2cebd6192">More...</a><br/></td></tr>
<tr class="separator:ga1f9a593126b7f0b66fc526c2cebd6192"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Description</h2>
<p>The <b>OS Tick API</b> is an interface to a system timer that generates the Kernel Ticks.</p>
<p>All Cortex-M processors provide an unified System Tick Timer that is typically used to generate the RTOS Kernel Tick. The Cortex-A processors do not implement an unified system timer and required a device specific implementation.</p>
<p>CMSIS-RTOS2 provides in the directory <a class="el" href="index.html#directory">CMSIS/RTOS2/Source</a> the several OS Tick implementations that can be used by any RTOS kernel.</p>
<table class="doxtable">
<tr>
<th align="left">Filename </th><th align="left">OS Tick Implementation for...  </th></tr>
<tr>
<td align="left"><b>os_systick.c</b> </td><td align="left">Cortex-M SysTick timer </td></tr>
<tr>
<td align="left"><b>os_tick_gtim.c</b> </td><td align="left">Cortex-A Generic Timer (available in some devices) </td></tr>
<tr>
<td align="left"><b>os_tick_ptim.c</b> </td><td align="left">Cortex-A Private Timer (available in some devices) </td></tr>
</table>
<dl class="section note"><dt>Note</dt><dd>The above OS Tick source files implement <code>weak</code> functions which may be overwritten by user-specific implementations. </dd></dl>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="ga5eeffb4d9dc6c6802fee8898096d9a59"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t OS_Tick_Setup </td>
          <td>(</td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>freq</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="os__tick_8h.html#afbfa2180a9b6208f34891d539e9e2d52">IRQHandler_t</a>&#160;</td>
          <td class="paramname"><em>handler</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">freq</td><td>tick frequency in Hz </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">handler</td><td>tick IRQ handler </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>0 on success, -1 on error.</dd></dl>
<p>Setup OS Tick timer to generate periodic RTOS Kernel Ticks.</p>
<p>The timer should be configured to generate periodic interrupts at frequency specified by <em>freq</em>. The parameter <em>handler</em> defines the interrupt handler function that is called.</p>
<p>The timer should only be initialized and configured but must not be started to create interrupts. The RTOS kernel calls the function <a class="el" href="group__CMSIS__RTOS__TickAPI.html#ga3e47971bf3a02599d9ecb32208adafec">OS_Tick_Enable</a> to start the timer interrupts.</p>
<p><b>Cortex-M SysTick implementation:</b> </p>
<div class="fragment"><div class="line"><span class="preprocessor">#ifndef SYSTICK_IRQ_PRIORITY</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#define SYSTICK_IRQ_PRIORITY    0xFFU</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#endif</span></div>
<div class="line"><span class="preprocessor"></span></div>
<div class="line"><span class="keyword">static</span> uint8_t PendST;</div>
<div class="line"></div>
<div class="line">int32_t  <a class="code" href="group__CMSIS__RTOS__TickAPI.html#ga5eeffb4d9dc6c6802fee8898096d9a59">OS_Tick_Setup</a> (uint32_t freq, <a class="code" href="os__tick_8h.html#afbfa2180a9b6208f34891d539e9e2d52">IRQHandler_t</a> handler) {</div>
<div class="line">  (void)handler;</div>
<div class="line">  uint32_t load;</div>
<div class="line"></div>
<div class="line">  <span class="keywordflow">if</span> (freq == 0U) {</div>
<div class="line">    <span class="keywordflow">return</span> (-1);</div>
<div class="line">  }</div>
<div class="line"></div>
<div class="line">  load = (SystemCoreClock / freq) - 1U;</div>
<div class="line">  <span class="keywordflow">if</span> (load &gt; 0x00FFFFFFU) {</div>
<div class="line">    <span class="keywordflow">return</span> (-1);</div>
<div class="line">  }</div>
<div class="line"></div>
<div class="line">  NVIC_SetPriority(SysTick_IRQn, SYSTICK_IRQ_PRIORITY);</div>
<div class="line"></div>
<div class="line">  SysTick-&gt;CTRL =  SysTick_CTRL_CLKSOURCE_Msk | SysTick_CTRL_TICKINT_Msk;</div>
<div class="line">  SysTick-&gt;LOAD =  load;</div>
<div class="line">  SysTick-&gt;VAL  =  0U;</div>
<div class="line"></div>
<div class="line">  PendST = 0U;</div>
<div class="line"></div>
<div class="line">  <span class="keywordflow">return</span> (0);</div>
<div class="line">}</div>
</div><!-- fragment --> 
</div>
</div>
<a class="anchor" id="ga3e47971bf3a02599d9ecb32208adafec"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t OS_Tick_Enable </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Enable OS Tick timer interrupt.</p>
<p>Enable and start the OS Tick timer to generate periodic RTOS Kernel Tick interrupts.</p>
<p><b>Cortex-M SysTick implementation:</b> </p>
<div class="fragment"><div class="line">int32_t  <a class="code" href="group__CMSIS__RTOS__TickAPI.html#ga3e47971bf3a02599d9ecb32208adafec">OS_Tick_Enable</a> (<span class="keywordtype">void</span>) {</div>
<div class="line"></div>
<div class="line">  <span class="keywordflow">if</span> (PendST != 0U) {</div>
<div class="line">    PendST = 0U;</div>
<div class="line">    SCB-&gt;ICSR = SCB_ICSR_PENDSTSET_Msk;</div>
<div class="line">  }</div>
<div class="line"></div>
<div class="line">  SysTick-&gt;CTRL |=  SysTick_CTRL_ENABLE_Msk;</div>
<div class="line"></div>
<div class="line">  <span class="keywordflow">return</span> (0);</div>
<div class="line">}</div>
</div><!-- fragment --> 
</div>
</div>
<a class="anchor" id="ga5e325c304fef5003b1dc31906f6a3056"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t OS_Tick_Disable </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Disable OS Tick timer interrupt.</p>
<p>Stop the OS Tick timer and disable generation of RTOS Kernel Tick interrupts.</p>
<p><b>Cortex-M SysTick implementation:</b> </p>
<div class="fragment"><div class="line">int32_t  <a class="code" href="group__CMSIS__RTOS__TickAPI.html#ga5e325c304fef5003b1dc31906f6a3056">OS_Tick_Disable</a> (<span class="keywordtype">void</span>) {</div>
<div class="line"></div>
<div class="line">  SysTick-&gt;CTRL &amp;= ~SysTick_CTRL_ENABLE_Msk;</div>
<div class="line"></div>
<div class="line">  <span class="keywordflow">if</span> ((SCB-&gt;ICSR &amp; SCB_ICSR_PENDSTSET_Msk) != 0U) {</div>
<div class="line">    SCB-&gt;ICSR = SCB_ICSR_PENDSTCLR_Msk;</div>
<div class="line">    PendST = 1U;</div>
<div class="line">  }</div>
<div class="line"></div>
<div class="line">  <span class="keywordflow">return</span> (0);</div>
<div class="line">}</div>
</div><!-- fragment --> 
</div>
</div>
<a class="anchor" id="ga57065ec4b281504ad4de13a419870b4f"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t OS_Tick_AcknowledgeIRQ </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Acknowledge execution of OS Tick timer interrupt.</p>
<p>Acknowledge the execution of the OS Tick timer interrupt function, for example clear the pending flag.</p>
<p><b>Cortex-M SysTick implementation:</b></p>
<div class="fragment"><div class="line">int32_t  <a class="code" href="group__CMSIS__RTOS__TickAPI.html#ga57065ec4b281504ad4de13a419870b4f">OS_Tick_AcknowledgeIRQ</a> (<span class="keywordtype">void</span>) {</div>
<div class="line">  (void)SysTick-&gt;CTRL;</div>
<div class="line">  return (0);</div>
<div class="line">}</div>
</div><!-- fragment --> 
</div>
</div>
<a class="anchor" id="gaa8b4eca23e3ffe2df403291958cdc905"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t OS_Tick_GetIRQn </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<dl class="section return"><dt>Returns</dt><dd>OS Tick IRQ number</dd></dl>
<p>Get OS Tick timer IRQ number.</p>
<p>Return the numeric value that identifies the interrupt called by the OS Tick timer.</p>
<p><b>Cortex-M SysTick implementation:</b></p>
<div class="fragment"><div class="line">int32_t  <a class="code" href="group__CMSIS__RTOS__TickAPI.html#gaa8b4eca23e3ffe2df403291958cdc905">OS_Tick_GetIRQn</a> (<span class="keywordtype">void</span>) {</div>
<div class="line">  <span class="keywordflow">return</span> (SysTick_IRQn);</div>
<div class="line">}</div>
</div><!-- fragment --> 
</div>
</div>
<a class="anchor" id="ga936217ea28236fb57648973e0d8f627a"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint32_t OS_Tick_GetClock </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<dl class="section return"><dt>Returns</dt><dd>OS Tick timer clock frequency in Hz</dd></dl>
<p>Get OS Tick timer clock frequency.</p>
<p>Return the input clock frequency of the OS Tick timer. This is the increment rate of the counter value returned by the function <a class="el" href="group__CMSIS__RTOS__TickAPI.html#gaa64a145a554f1e5077848938d7f39c92">OS_Tick_GetCount</a>. This function is used to by the function <a class="el" href="group__CMSIS__RTOS__KernelCtrl.html#ga4d69215a93220f72be3684cad582f16a">osKernelGetSysTimerFreq</a>.</p>
<p><b>Cortex-M SysTick implementation:</b></p>
<div class="fragment"><div class="line">uint32_t <a class="code" href="group__CMSIS__RTOS__TickAPI.html#ga936217ea28236fb57648973e0d8f627a">OS_Tick_GetClock</a> (<span class="keywordtype">void</span>) {</div>
<div class="line">  <span class="keywordflow">return</span> (SystemCoreClock);</div>
<div class="line">}</div>
</div><!-- fragment --> 
</div>
</div>
<a class="anchor" id="ga123151dc19d5a94a68f12cdbf61a9bb5"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint32_t OS_Tick_GetInterval </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<dl class="section return"><dt>Returns</dt><dd>OS Tick timer interval reload value</dd></dl>
<p>Get OS Tick timer interval reload value.</p>
<p>Return the number of counter ticks between to periodic OS Tick timer interrupts.</p>
<p><b>Cortex-M SysTick implementation:</b></p>
<div class="fragment"><div class="line">uint32_t <a class="code" href="group__CMSIS__RTOS__TickAPI.html#ga123151dc19d5a94a68f12cdbf61a9bb5">OS_Tick_GetInterval</a> (<span class="keywordtype">void</span>) {</div>
<div class="line">  <span class="keywordflow">return</span> (SysTick-&gt;LOAD + 1U);</div>
<div class="line">}</div>
</div><!-- fragment --> 
</div>
</div>
<a class="anchor" id="gaa64a145a554f1e5077848938d7f39c92"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint32_t OS_Tick_GetCount </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<dl class="section return"><dt>Returns</dt><dd>OS Tick timer counter value</dd></dl>
<p>Get OS Tick timer counter value.</p>
<p>Return the current value of the OS Tick counter: 0 ... (reload value -1). The reload value is returned by the function <a class="el" href="group__CMSIS__RTOS__TickAPI.html#ga123151dc19d5a94a68f12cdbf61a9bb5">OS_Tick_GetInterval</a>. The OS Tick timer counter value is used to by the function <a class="el" href="group__CMSIS__RTOS__KernelCtrl.html#gae0fcaff6cecfb4013bb556c87afcd7d2">osKernelGetSysTimerCount</a>.</p>
<p><b>Cortex-M SysTick implementation:</b></p>
<div class="fragment"><div class="line">uint32_t <a class="code" href="group__CMSIS__RTOS__TickAPI.html#gaa64a145a554f1e5077848938d7f39c92">OS_Tick_GetCount</a> (<span class="keywordtype">void</span>) {</div>
<div class="line">  uint32_t load = SysTick-&gt;LOAD;</div>
<div class="line">  <span class="keywordflow">return</span>  (load - SysTick-&gt;VAL);</div>
<div class="line">}</div>
</div><!-- fragment --> 
</div>
</div>
<a class="anchor" id="ga1f9a593126b7f0b66fc526c2cebd6192"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">OS_Tick_GetOverflow </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<dl class="section return"><dt>Returns</dt><dd>OS Tick overflow status (1 - overflow, 0 - no overflow).</dd></dl>
<p>Get OS Tick timer overflow status.</p>
<p>Return the state of OS Tick timer interrupt pending bit that indicates timer overflows to adjust SysTimer calculations.</p>
<p><b>Cortex-M SysTick implementation:</b></p>
<div class="fragment"><div class="line">uint32_t <a class="code" href="group__CMSIS__RTOS__TickAPI.html#ga1f9a593126b7f0b66fc526c2cebd6192">OS_Tick_GetOverflow</a> (<span class="keywordtype">void</span>) {</div>
<div class="line">  <span class="keywordflow">return</span> ((SysTick-&gt;CTRL &gt;&gt; 16) &amp; 1U);</div>
<div class="line">}</div>
</div><!-- fragment --> 
</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">Generated on Wed Jul 10 2019 15:21:04 for CMSIS-RTOS2 Version 2.1.3 by Arm Ltd. All rights reserved.
	<!--
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.6 
	-->
	</li>
  </ul>
</div>
</body>
</html>
